// file转base64
export default function readFileFormatBase64(file) {
  return new Promise((resolve, reject) => {
    var reader = new FileReader();
    reader.onload = function (e) {
      var base64String = e.target.result;
      resolve(base64String);
    };

    reader.onerror = function (e) {
      console.log('File could not be read! Code ' + e.target.error.code);
    };

    reader.readAsDataURL(file); // 读取文件为Base64
  });
}
